package com.example.mydianping.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mydianping.pojo.SeckillVoucher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface VoucherSeckillMapper extends BaseMapper<SeckillVoucher> {

    @Update("update tb_seckill_voucher set stock = stock-1 where voucher_id = #{voucherId} and stock > 0")
    boolean updateSecStock(@Param("voucherId") Long voucherId);

}